#ifndef __H_LOGGER__
#define __H_LOGGER__
#include <iostream>
#include <time.h>
enum
{
    INFO = 0,
    DEBUG,
    ERROR
};
#define DEFAULT_LEVEL DEBUG
#define LOG(level,format,...) do{\
    if(DEFAULT_LEVEL > level) break;\
    time_t t = time(nullptr);\
    struct tm* lt = localtime(&t);\
    char buf[32] = {0};\
    strftime(buf,31,"%H:%M:%S",lt);\
    fprintf(stdout,"[%s %s:%d] " format "\n",buf,__FILE__,__LINE__,##__VA_ARGS__);\
}while(0)

#define ILOG(format,...) LOG(INFO,format,##__VA_ARGS__);
#define DLOG(format,...) LOG(DEBUG,format,##__VA_ARGS__);
#define ELOG(format,...) LOG(ERROR,format,##__VA_ARGS__);
#endif